﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Runtime.Serialization;


namespace MoviTiendas.Logica
{
    [DataContract]
    public class Tienda
    {
         [DataMember]
        public String nombre { get; set; }
         [DataMember]
        public String descripcion { get; set;}
         [DataMember]
        public String direccion { get; set; }
         [DataMember]
        public String telefono { get; set; }

        public List<Categoria> categorias { get; set; }
         [DataMember]
        public int horaAbrir { get; set; }
         [DataMember]
        public int horaCerrar { get; set; }
         [DataMember]
        public int diasAbierto { get; set; }

        public Tienda(String nombre, String direccion, String descripcion, String telefono, int horaAbrir, int horaCerrar, int diasAbierto)
        {
            this.nombre = nombre;
            this.direccion = direccion;
            this.descripcion = descripcion;
            this.telefono = telefono;
            this.horaAbrir = horaAbrir;
            this.horaCerrar = horaCerrar;
            this.diasAbierto = diasAbierto;
            categorias = new List<Categoria>();
        }


        public String darHorario()
        {          
            String horaAbr = "";
            String horaCer = "";
            if(1<=horaAbrir && horaAbrir<=12)
                horaAbr = horaAbrir + ":00am";
            else
                horaAbr = horaAbrir-12 + ":00pm";  
            
            if(1<=horaCerrar && horaCerrar<=12)
                horaCer = horaCerrar + ":00am";
            else
                horaCer = horaCerrar-12 + ":00pm";      

            return "De "+ horaAbr + " a " +horaCer;
        }

        public override bool Equals(object obj)
        {
            bool esIgual = false;
            Tienda t = obj as Tienda;

            if (this.nombre.Equals(t.nombre))
                esIgual = true;
            
            return esIgual;
        }

    }
}
